﻿
<style>
    .modal-lg {
        max-width: 1000px;
    }
</style>

<script src="~/admui-13945148017-1592211513218/public/themes/global/js/components/bootstrap-datepicker.min.js"></script>
<script src="~/admui-13945148017-1592211513218/public/vendor/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
<script src="~/admui-13945148017-1592211513218/public/vendor/bootstrap-datepicker/bootstrap-datepicker.zh-CN.min.js"></script>
<link href="~/admui-13945148017-1592211513218/public/vendor/bootstrap-datepicker/bootstrap-datepicker.min.css" rel="stylesheet" />
<link href="~/admui-13945148017-1592211513218/public/css/examples/tables/datatable.css" rel="stylesheet" />
<link href="~/admui-13945148017-1592211513218/public/vendor/datatables-responsive/dataTables.responsive.css" rel="stylesheet" />
<link href="~/admui-13945148017-1592211513218/public/vendor/datatables-bootstrap/dataTables.bootstrap4.css" rel="stylesheet" />
<link href="~/admui-13945148017-1592211513218/public/vendor/datatables-responsive/dataTables.responsive.css" rel="stylesheet" />
<script src="~/admui-13945148017-1592211513218/public/vendor/datatables/jquery.dataTables.min.js"></script>
<script src="~/admui-13945148017-1592211513218/public/vendor/datatables-bootstrap/dataTables.bootstrap.min.js"></script>
<script src="~/admui-13945148017-1592211513218/public/vendor/datatables-bootstrap/dataTables.bootstrap4.js"></script>
<script src="~/admui-13945148017-1592211513218/public/vendor/datatables-responsive/dataTables.responsive.min.js"></script>
<div class="page-container" id="admui-pageContent">
    <div class="page animation-fade page-forms">
        <div class="page-header">
            <h1 class="page-title">数据列表</h1>
            <ol class="breadcrumb">
                <li class="breadcrumb-item">
                    <a class="icon wb-home" href="javascript:;">数据管理</a>
                </li>
                <li class="breadcrumb-item active">数据列表</li>
            </ol>
        </div>
        <div class="page-content">
            <div class="panel">
                <div class="panel-body container-fluid">
                    <h4 class="example-title">数据查询</h4>
                    <div class="row">

                        <div class="form-group col-sm-4">
                            <label class="control-label" for="inputBasicPassword">客户名称</label>
                            <input type="text" class="form-control" id="ipt_kehumingcheng" name="" placeholder="请输入客户名称" autocomplete="off" />
                        </div>
                        <div class="form-group col-sm-4">
                            <label class="control-label" for="inputBasicPassword">手机号</label>
                            <input type="text" class="form-control" id="ipt_shoujihao" name="" placeholder="请输入人手机号" autocomplete="off" />
                        </div>
                        <div class="form-group col-sm-4" style="padding-top:27px">
                            <button type="button" id="bt_ChaXun" class="btn btn-block btn-success" style="width: 45%; float: left;" onclick="bang('查')"><i class="icon wb-search"></i>查询</button>
                            <span style="padding-left:10%"></span>
                            <button typeutton" id="bt_ChongZhi" class="btn btn-outline btn-success" style="width: 45%;" onclick="chongzhi();">重置</button>
                        </div>
                    </div>
                </div>
                <div class="panel-body">
                    <table class="table table-bordered table-hover dataTable table-striped w-full text-nowrap" id="dataTableExample" data-plugin="dataTable">
                        <thead>
                            <tr>
                                <th>客户姓名</th>
                                <th>性别</th>
                                <th>年龄</th>
                                <th>状态</th>
                                <th>手机号码</th>
                                <th>意向小区</th>
                                <th>意向等级</th>
                                <th>人员</th>
                                <th>岗位</th>
                                <th>部门</th>
                                <th>部门状态</th>
                                @*<th>公司</th>*@
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tfoot>
                            <tr>
                                <th>客户姓名</th>
                                <th>性别</th>
                                <th>年龄</th>
                                <th>状态</th>
                                <th>手机号码</th>
                                <th>意向小区</th>
                                <th>意向等级</th>
                                <th>人员</th>
                                <th>岗位</th>
                                <th>部门</th>
                                <th>部门状态</th>
                                @*<th>公司</th>*@
                                <th>操作</th>
                            </tr>
                        </tfoot>
                        <tbody>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="modal fade example-modal-lg" id="exampleFormModal" aria-hidden="true" aria-labelledby="exampleFormModalLabel" role="dialog" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog modal-lg" style="width: 100%; height: 80%">
        <div class="modal-content" style="width: 100%; height: 90%">
            <div class="modal-header" style="background-color:#0099FF">
                <label id="CunId" style="display:none"></label>
                <button type="button" class="close" data-dismiss="modal" id="guanbiaddkehu" onclick="" aria-label="关闭">
                    <span aria-hidden="true">×</span>
                </button>
                <h4 class="modal-title" id="exampleFormModalLabel">选择房源</h4>
            </div>
            <div class="row">
                <input type="text" id="IptId" name="name" style="display:none" value="" />
                <div class="form-group col-sm-12"></div>
                <div class="form-group col-sm-1"></div>
                <div class="form-group col-sm-10"></div>
                <div class="form-group col-sm-1"></div>
                <div class="form-group col-sm-1"></div>
                <div class="form-group col-sm-10">
                    <label class="control-label" for="inputBasicPassword">客户状态</label>
                    <select class="form-control" id="i_sle_ZhuangTai" name="" data-fv-notempty="true" data-fv-field="requiredSelect">
                        <option value="已认筹">已认筹</option>
                        <option value="已认购">已认购</option>
                        <option value="已签约">已签约</option>
                        <option value="已退房">已退房</option>
                    </select>
                </div>
                <div class="form-group col-sm-1"></div>
                <div class="form-group col-sm-1"></div>
                <div class="form-group col-sm-10">
                    <label class="control-label" for="inputBasicPassword">小区名称</label>
                    <select class="form-control" id="selxiaoqu" name="" data-fv-notempty="true" data-fv-field="requiredSelect"></select>
                </div>
                <div class="form-group col-sm-1"></div>
                <div class="form-group col-sm-1"></div>
                <div class="form-group col-sm-10">
                    <label class="control-label" for="inputBasicPassword">楼号</label>
                    <select class="form-control" id="sellouhao" name="" data-fv-notempty="true" data-fv-field="requiredSelect"></select>
                </div>
                <div class="form-group col-sm-1"></div>
                <div class="form-group col-sm-1"></div>
                <div class="form-group col-sm-10">
                    <label class="control-label" for="inputBasicPassword">层</label>
                    <select class="form-control" id="selceng" name="" data-fv-notempty="true" data-fv-field="requiredSelect"></select>
                </div>
                <div class="form-group col-sm-1"></div>
                <div class="form-group col-sm-1"></div>
                <div class="form-group col-sm-10">
                    <label class="control-label" for="inputBasicPassword">门</label>
                    <select class="form-control" id="selmen" name="" data-fv-notempty="true" data-fv-field="requiredSelect"></select>
                </div>
                <div class="form-group col-sm-1"></div>
                <div class="form-group col-sm-1"></div>
                <div class="form-group col-sm-10" style="margin-top:27px;">
                    <label class="control-label" for="inputBasicPassword">房源状态:</label>
                    <label class="control-label" for="inputBasicPassword" id="zhuangtai"></label>
                </div>
                <div class="form-group col-sm-1"></div>
                <div class="form-group col-sm-1"></div>
                <div class="form-group col-sm-10">
                    <label class="control-label" for="inputBasicPassword">成交金额</label>
                    <input type="text" name="asdf" id="iptmoney" class="form-control" value="" />
                </div>
                <div class="form-group col-sm-3"></div>
                <div class="form-group col-sm-6">
                    <button type="button" id="i_btn_queding" class="btn btn-outline btn-success" style="width: 100%;" onclick="tianjiaxiaoshou();">确定</button>
                </div>
                <div class="form-group col-sm-3"></div>
            </div>
        </div>
    </div>
</div>

<div class="modal fade example-modal-lg" id="exampleFormModal2" aria-hidden="true" aria-labelledby="exampleFormModalLabel" role="dialog" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog modal-lg" style="width: 100%; height: 80%">
        <div class="modal-content" style="width: 100%; height: 90%">
            <div class="modal-header" style="background-color:#0099FF">
                <label id="CunId" style="display:none"></label>
                <button type="button" class="close" data-dismiss="modal" id="guanbiaddkehu" onclick="guanbiqingkong()" aria-label="关闭">
                    <span aria-hidden="true">×</span>
                </button>
                <h4 class="modal-title" id="exampleFormModalLabel">选择房源</h4>
            </div>
            <div class="panel-body">
                <div class="row">
                    <label class="control-label" for="inputBasicPassword" id="Id" hidden="hidden"></label>
                    <div class="col-md-3"></div>
                    <div class="col-md-3">
                        <label class="control-label" for="inputBasicPassword">客户姓名:</label>
                        <label class="control-label" for="inputBasicPassword" id="i_lbl_KeHuXingMing"></label>
                    </div>
                    <div class="col-md-3">
                        <label class="control-label" for="inputBasicPassword">总成交金额为:</label>
                        <label class="control-label" for="inputBasicPassword" id="i_lbl_ChengJiaoJinE"></label>
                    </div>
                    <div class="col-md-3"></div>
                    <div class="col-md-12">
                        <table class="table table-bordered table-hover dataTable table-striped w-full text-nowrap" id="dataTableExample2" data-plugin="dataTable">
                            <thead>
                                <tr>
                                    <th>小区名称</th>
                                    <th>楼号</th>
                                    <th>层</th>
                                    <th>门</th>
                                    <th>成交金额</th>
                                    <th>房源状态</th>
                                    <th>销售状态</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tfoot>
                                <tr>
                                    <th>小区名称</th>
                                    <th>楼号</th>
                                    <th>层</th>
                                    <th>门</th>
                                    <th>成交金额</th>
                                    <th>房源状态</th>
                                    <th>销售状态</th>
                                    <th>操作</th>
                                </tr>
                            </tfoot>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>















<script type="text/javascript">
    $(document).ready(function () {
        //是否从客户补录跳转过来的
        var Id = getQuery("Id");
        if (Id != null) {
            bang('不查', Id)
        } else {
            bang('不查')
        }
        //小区绑定
        BindSelXiaoQu();
        //修改下拉框绑定3
        $('#selxiaoqu').bind('input propertychange', function () {
            $("#sellouhao").empty();
            $("#selceng").empty();
            $("#selmen").empty();
            $("#zhuangtai").text("");
            $.ajax({
                url: "../KeHu/BindSelLouHao",
                type: "post",
                data: { "XiaoQuId": $("#selxiaoqu").val() },
                dataType: "json",
                success: function (response) {
                    if ($("#selxiaoqu").val() != 0) {
                        var ddl = $("#sellouhao");
                        var opt0 = $("<option></option>").text("请选择").val(0);
                        ddl.append(opt0);
                    }
                    $(response).each(function (key) {
                        var opt = $("<option></option>").text(response[key].LouHao + "号楼").val(response[key].LouHao);
                        ddl.append(opt);
                    })
                }
            });
        })
        //修改下拉框绑定3
        $('#sellouhao').bind('input propertychange', function () {
            $("#selceng").empty();
            $("#selmen").empty();
            $("#zhuangtai").text("");
            $.ajax({
                url: "../KeHu/BindSelCeng",
                type: "post",
                data: { "LouHao": $("#sellouhao").val(), "XiaoQuId": $("#selxiaoqu").val() },
                dataType: "json",
                success: function (response) {
                    if ($("#sellouhao").val() != 0) {
                        var ddl = $("#selceng");
                        var opt0 = $("<option></option>").text("请选择").val(0);
                        ddl.append(opt0);
                    }
                    $(response).each(function (key) {
                        var opt = $("<option></option>").text(response[key].Ceng + "层").val(response[key].Ceng);
                        ddl.append(opt);
                    })
                }
            });
        })
        //修改下拉框绑定3
        $('#selceng').bind('input propertychange', function () {
            $("#selmen").empty();
            $("#zhuangtai").text("");
            $.ajax({
                url: "../KeHu/BindSelMen",
                type: "post",
                data: { "LouHao": $("#sellouhao").val(), "XiaoQuId": $("#selxiaoqu").val(), "Ceng": $("#selceng").val() },
                dataType: "json",
                success: function (response) {
                    if ($("#selceng").val() != 0) {
                        var ddl = $("#selmen");
                        var opt0 = $("<option></option>").text("请选择").val(0);
                        ddl.append(opt0);
                    }
                    $(response).each(function (key) {
                        var opt = $("<option></option>").text(response[key].Men + "门").val(response[key].Men);
                        ddl.append(opt);
                    })
                }
            });
        })
        $("#SpanShuJu").click();
        //修改下拉框事件3 调用房源状态
        document.getElementById('selmen').onchange = function () {
            if ($("#selmen").find("option:selected").val() != 0) {
                zhuangtai2();
            } else {
                $("#zhuangtai").text("");
            }

        };
    })

    function BindSelXiaoQu() {
        $.ajax({
            url: "../KeHu/BindSelXiaoQu",
            type: "post",
            dataType: "json",
            success: function (response) {
                var ddl = $("#selxiaoqu");
                var opt = $("<option></option>").text("请选择").val(0);
                ddl.append(opt);
                $(response).each(function (key) {
                    var opt = $("<option></option>").text(response[key].XiaoQuMingCheng).val(response[key].Id);
                    ddl.append(opt);
                })
                console.log(response);
            }
        });
    }

    //绑定公司列表
    function bang(panduan, Id) {
        //修改后进行查询
        if (Id == null || Id == undefined) {
            Id = 0;
        } else {
            Id;
        }
        //是不是点击的查询按钮
        if (panduan == "查") {
            ipt_kehumingcheng = $("#ipt_kehumingcheng").val();
            ipt_shoujihao = $("#ipt_shoujihao").val();
            //ipt_renyuanmingcheng = $("#ipt_renyuanmingcheng").val();
        } else if (panduan == "不查") {
            ipt_kehumingcheng = "";
            ipt_shoujihao = "";
            //ipt_renyuanmingcheng = "";
        }
        var lang = {
            "sProcessing": "大量处理中，请稍后...",
            "sLengthMenu": "每页 _MENU_ 项",
            "sZeroRecords": "没有匹配结果",
            "sInfo": "当前显示第 _START_ 至 _END_ 项，共 _TOTAL_ 项。",
            "sInfoEmpty": "当前显示第 0 至 0 项，共 0 项",
            "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
            "sInfoPostFix": "",
            "sSearch": "搜索:",
            "sUrl": "",
            "sEmptyTable": "表中数据为空",
            "sLoadingRecords": "载入中...",
            "sInfoThousands": ",",
            "oPaginate": {
                "sFirst": "首页",
                "sPrevious": "上页",
                "sNext": "下页",
                "sLast": "末页",
                "sJump": "跳转"
            },
            "oAria": {
                "sSortAscending": ": 以升序排列此列",
                "sSortDescending": ": 以降序排列此列"
            }
        };
        $("#dataTableExample").dataTable().fnDestroy();
        $('#dataTableExample').dataTable({
            "order": [[0, "asc"]],
            "language": lang,
            "processing": true,
            "serverSide": true,
            //"bStateSave": true,//状态保持模式
            "searching": false,//禁用搜索
            ajax: function (data, callback, settings) {
                //封装请求参数
                console.log(data);
                var param = {};
                param.sw = "";
                param.limit = data.length;//页面显示记录条数，在页面显示每页显示多少项的时候
                param.start = data.start;//开始的记录序号
                param.page = (data.start / data.length) + 1;//当前页码
                param.dir = data.order[0].dir;
                param.column = data.order[0].column;
                param.ipt_kehumingcheng = ipt_kehumingcheng;
                param.ipt_shoujihao = ipt_shoujihao;
                //param.ipt_renyuanmingcheng = ipt_renyuanmingcheng;
                param.wo = "wo";
                param.Id = Id;
                console.log(param);

                //ajax请求数据
                $.ajax({
                    type: "POST",
                    url: '../KeHu/InitializationDataTable',
                    cache: false,  //禁用缓存
                    data: param,  //传入组装的参数
                    dataType: "json",
                    success: function (result) {
                        console.log(result);
                        //setTimeout仅为测试延迟效果
                        setTimeout(function () {
                            //封装返回数据
                            var returnData = {};
                            returnData.draw = data.draw;//这里直接自行返回了draw计数器,应该由后台返回
                            returnData.recordsTotal = result.total;//返回数据全部记录
                            returnData.recordsFiltered = result.total;//后台不实现过滤功能，每次查询均视作全部结果
                            returnData.data = result.data;//返回的数据列表
                            console.log(returnData);
                            //调用DataTables提供的callback方法，代表数据已封装完成并传回DataTables进行渲染
                            //此时的数据需确保正确无误，异常判断应在执行此回调前自行处理完毕"orderable" : false
                            callback(returnData);
                        }, 200);
                    }
                });
            },
            "columns": [
                { "data": "KeHuXingMing" },
                { "data": "XingBie" },
                { "data": "NianLing" },
                { "data": "ZhuangTai" },
                { "data": "ShouJiHaoMa" },
                { "data": "YiXiangXinXi" },
                { "data": "YiXiangDengJi" },
                { "data": "t_RenYuanBiao.XingMing" },
                { "data": "t_RenYuanBiao.t_GangWeiBiao.GangWeiMingCheng" },
                { "data": "t_RenYuanBiao.t_GangWeiBiao.t_BuMenBiao.BuMenMingCheng" },
                { "data": "t_RenYuanBiao.t_GangWeiBiao.t_BuMenBiao.ZhanQuZhuangTai" },
                //{ "data": "t_RenYuanBiao.t_GangWeiBiao.t_BuMenBiao.t_GongSiBiao.GongSiMingCheng" },
                { "data": null }
            ],
            columnDefs: [{
                //   指定第最后一列
                targets: -1,
                //加下面属性 不参与排序
                sortable: false,
                render: function (data, type, row, meta) {
                    return '<a title = "" data-target="#exampleFormModal" class="btn btn-outline btn-default" data-toggle="modal" id="btn_Xz" onclick="suodingxiaoqu(' + row.Id + ')">+新建销售</a>' +
                        '<a title = "" data-target="#exampleFormModal2" class="btn btn-outline btn-default" data-toggle="modal" id="btn_Xz" onclick="xianshiJine(' + row.Id + ')"><i class="icon wb-search" aria-hidden="true"></i>查看房源</a>';
                }
            }]
        })
    }

    //绑定公司列表
    function bang2(Id) {
        var lang = {
            "sProcessing": "大量处理中，请稍后...",
            "sLengthMenu": "每页 _MENU_ 项",
            "sZeroRecords": "没有匹配结果",
            "sInfo": "当前显示第 _START_ 至 _END_ 项，共 _TOTAL_ 项。",
            "sInfoEmpty": "当前显示第 0 至 0 项，共 0 项",
            "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
            "sInfoPostFix": "",
            "sSearch": "搜索:",
            "sUrl": "",
            "sEmptyTable": "表中数据为空",
            "sLoadingRecords": "载入中...",
            "sInfoThousands": ",",
            "oPaginate": {
                "sFirst": "首页",
                "sPrevious": "上页",
                "sNext": "下页",
                "sLast": "末页",
                "sJump": "跳转"
            },
            "oAria": {
                "sSortAscending": ": 以升序排列此列",
                "sSortDescending": ": 以降序排列此列"
            }
        };
        $("#dataTableExample2").dataTable().fnDestroy();
        $('#dataTableExample2').dataTable({
            "order": [[0, "asc"]],
            "language": lang,
            "processing": true,
            "serverSide": true,
            //"bStateSave": true,//状态保持模式
            "searching": false,//禁用搜索
            ajax: function (data, callback, settings) {
                //封装请求参数
                console.log(data);
                var param = {};
                param.limit = data.length;//页面显示记录条数，在页面显示每页显示多少项的时候
                param.start = data.start;//开始的记录序号
                param.page = (data.start / data.length) + 1;//当前页码
                param.dir = data.order[0].dir;
                param.column = data.order[0].column;
                param.Id = Id;
                console.log(param);
                //ajax请求数据
                $.ajax({
                    type: "POST",
                    url: '../KeHu/InitializationDataTable2',
                    cache: false,  //禁用缓存
                    data: param,  //传入组装的参数
                    dataType: "json",
                    success: function (result) {
                        console.log(result);
                        //setTimeout仅为测试延迟效果
                        setTimeout(function () {
                            //封装返回数据
                            var returnData = {};
                            returnData.draw = data.draw;//这里直接自行返回了draw计数器,应该由后台返回
                            returnData.recordsTotal = result.total;//返回数据全部记录
                            returnData.recordsFiltered = result.total;//后台不实现过滤功能，每次查询均视作全部结果
                            returnData.data = result.data;//返回的数据列表
                            console.log(returnData);
                            //调用DataTables提供的callback方法，代表数据已封装完成并传回DataTables进行渲染
                            //此时的数据需确保正确无误，异常判断应在执行此回调前自行处理完毕"orderable" : false
                            callback(returnData);
                        }, 200);
                    }
                });
            },
            "columns": [
                { "data": "XiaoQuMingCheng" },
                { "data": "LouHao" },
                { "data": "Ceng" },
                { "data": "Men" },
                { "data": "ChengJiaoJinE" },
                { "data": "ZhuangTai" },
                { "data": "BeiZhu1" },
                { "data": null }
            ],
            columnDefs: [{
                //   指定第最后一列
                targets: -1,
                //加下面属性 不参与排序
                sortable: false,
                render: function (data, type, row, meta) {
                    if (row.BeiZhu1 == "已签约") {
                        return '<a title="" id="aid" data-target="#exampleFormModal" class="tanceng" data-toggle="modal" id="btn_Xz"><i class="" aria-hidden="true"></i></a><a class="yong"><button disabled="disabled" id="' + row.Id + '" style="background-color:#00BFFF;color:#ffffff;font-size: inherit;border: 1px solid transparent;padding: 0.286rem 0.858rem;border-radius: 0.215rem;margin: 0px 3px;cursor: pointer;" type="button" class="btn" value="" onclick="zhuangtai(' + row.Id + ',1)">已认筹</button></a>' +
                            '<a title="" id="aid" data-target="#exampleFormModal" class="tanceng" data-toggle="modal" id="btn_Xz"><i class="" aria-hidden="true"></i></a><a class="yong"><button disabled="disabled" id="' + row.Id + '" style="background-color:#32CD32;color:#ffffff;font-size: inherit;border: 1px solid transparent;padding: 0.286rem 0.858rem;border-radius: 0.215rem;margin: 0px 3px;cursor: pointer;" type="button" class="btn" value="" onclick="zhuangtai(' + row.Id + ',2)">已认购</button></a>' +
                            '<a title="" id="aid" data-target="#exampleFormModal" class="tanceng" data-toggle="modal" id="btn_Xz"><i class="" aria-hidden="true"></i></a><a class="yong"><button disabled="disabled" id="' + row.Id + '" style="background-color:#FFA500;color:#ffffff;font-size: inherit;border: 1px solid transparent;padding: 0.286rem 0.858rem;border-radius: 0.215rem;margin: 0px 3px;cursor: pointer;" type="button" class="btn" value="" onclick="zhuangtai(' + row.Id + ',3)">已签约</button></a>' +
                            '<a title="" id="aid" data-target="#exampleFormModal" class="tanceng" data-toggle="modal" id="btn_Xz"><i class="" aria-hidden="true"></i></a><a class="yong"><button id="' + row.Id + '" style="background-color:#FF0000;color:#ffffff;font-size: inherit;border: 1px solid transparent;padding: 0.286rem 0.858rem;border-radius: 0.215rem;margin: 0px 3px;cursor: pointer;" type="button" class="btn" value="" onclick="zhuangtai(' + row.Id + ',4)">已退房</button></a>';
                    } else if (row.BeiZhu1 == "已退房") {
                        return '<a title="" id="aid" data-target="#exampleFormModal" class="tanceng" data-toggle="modal" id="btn_Xz"><i class="" aria-hidden="true"></i></a><a class="yong"><button disabled="disabled" id="' + row.Id + '" style="background-color:#00BFFF;color:#ffffff;font-size: inherit;border: 1px solid transparent;padding: 0.286rem 0.858rem;border-radius: 0.215rem;margin: 0px 3px;cursor: pointer;" type="button" class="btn" value="" onclick="zhuangtai(' + row.Id + ',1)">已认筹</button></a>' +
                            '<a title="" id="aid" data-target="#exampleFormModal" class="tanceng" data-toggle="modal" id="btn_Xz"><i class="" aria-hidden="true"></i></a><a class="yong"><button disabled="disabled" id="' + row.Id + '" style="background-color:#32CD32;color:#ffffff;font-size: inherit;border: 1px solid transparent;padding: 0.286rem 0.858rem;border-radius: 0.215rem;margin: 0px 3px;cursor: pointer;" type="button" class="btn" value="" onclick="zhuangtai(' + row.Id + ',2,)">已认购</button></a>' +
                            '<a title="" id="aid" data-target="#exampleFormModal" class="tanceng" data-toggle="modal" id="btn_Xz"><i class="" aria-hidden="true"></i></a><a class="yong"><button disabled="disabled" id="' + row.Id + '" style="background-color:#FFA500;color:#ffffff;font-size: inherit;border: 1px solid transparent;padding: 0.286rem 0.858rem;border-radius: 0.215rem;margin: 0px 3px;cursor: pointer;" type="button" class="btn" value="" onclick="zhuangtai(' + row.Id + ',3)">已签约</button></a>' +
                            '<a title="" id="aid" data-target="#exampleFormModal" class="tanceng" data-toggle="modal" id="btn_Xz"><i class="" aria-hidden="true"></i></a><a class="yong"><button disabled="disabled" id="' + row.Id + '" style="background-color:#FF0000;color:#ffffff;font-size: inherit;border: 1px solid transparent;padding: 0.286rem 0.858rem;border-radius: 0.215rem;margin: 0px 3px;cursor: pointer;" type="button" class="btn" value="" onclick="zhuangtai(' + row.Id + ',4)">已退房</button></a>';
                    } else {
                        return '<a title="" id="aid" data-target="#exampleFormModal" class="tanceng" data-toggle="modal" id="btn_Xz"><i class="" aria-hidden="true"></i></a><a class="yong"><button id="' + row.Id + '" style="background-color:#00BFFF;color:#ffffff;font-size: inherit;border: 1px solid transparent;padding: 0.286rem 0.858rem;border-radius: 0.215rem;margin: 0px 3px;cursor: pointer;" type="button" class="btn" value="" onclick="zhuangtai(' + row.Id + ',1,)">已认筹</button></a>' +
                            '<a title="" id="aid" data-target="#exampleFormModal" class="tanceng" data-toggle="modal" id="btn_Xz"><i class="" aria-hidden="true"></i></a><a class="yong"><button id="' + row.Id + '" style="background-color:#32CD32;color:#ffffff;font-size: inherit;border: 1px solid transparent;padding: 0.286rem 0.858rem;border-radius: 0.215rem;margin: 0px 3px;cursor: pointer;" type="button" class="btn" value="" onclick="zhuangtai(' + row.Id + ',2,)">已认购</button></a>' +
                            '<a title="" id="aid" data-target="#exampleFormModal" class="tanceng" data-toggle="modal" id="btn_Xz"><i class="" aria-hidden="true"></i></a><a class="yong"><button id="' + row.Id + '" style="background-color:#FFA500;color:#ffffff;font-size: inherit;border: 1px solid transparent;padding: 0.286rem 0.858rem;border-radius: 0.215rem;margin: 0px 3px;cursor: pointer;" type="button" class="btn" value="" onclick="zhuangtai(' + row.Id + ',3,)">已签约</button></a>' +
                            '<a title="" id="aid" data-target="#exampleFormModal" class="tanceng" data-toggle="modal" id="btn_Xz"><i class="" aria-hidden="true"></i></a><a class="yong"><button id="' + row.Id + '" style="background-color:#FF0000;color:#ffffff;font-size: inherit;border: 1px solid transparent;padding: 0.286rem 0.858rem;border-radius: 0.215rem;margin: 0px 3px;cursor: pointer;" type="button" class="btn" value="" onclick="zhuangtai(' + row.Id + ',4,)">已退房</button></a>';
                    }
                }
            }]
        })
    }

    //锁定小区
    function suodingxiaoqu(Id) {
        $("#selxiaoqu").attr("disabled", "disabled");
        $("#sellouhao").empty();
        $("#selceng").empty();
        $("#selmen").empty();
        $("#zhuangtai").text("");
        $("#iptmoney").val("");
        $.ajax({
            type: "POST",
            url: "../KeHu/Suodingxiaoqu",
            cache: false,  //禁用缓存
            data: { "kehuid": Id },  //传入组装的参数
            dataType: "text",
            success: function (result) {
                if (result != 0) {
                    $("#selxiaoqu").val(result)
                } else {
                    $("#selxiaoqu").val(result)
                    $("#selxiaoqu").removeAttr("disabled", "disabled");
                }
                $("#IptId").val(Id);
                //下拉框刷新
                $.ajax({
                    url: "../KeHu/BindSelLouHao",
                    type: "post",
                    data: { "XiaoQuId": $("#selxiaoqu").val() },
                    dataType: "json",
                    success: function (response) {
                        console.log(response);
                        if ($("#selxiaoqu").val() != 0) {
                            var ddl = $("#sellouhao");
                            var opt0 = $("<option></option>").text("请选择").val(0);
                            ddl.append(opt0);
                        }
                        $(response).each(function (key) {
                            var opt = $("<option></option>").text(response[key].LouHao + "号楼").val(response[key].LouHao);
                            ddl.append(opt);
                        })
                    }
                });
            }

        })
    }

    //添加销售信息
    function tianjiaxiaoshou() {
        if ($("#selxiaoqu").val() == "请选择" || $("#selxiaoqu").val() == undefined || $("#selxiaoqu").val() == "") {
            alert('请选择小区！');
        } else if ($("#sellouhao").val() == "请选择" || $("#sellouhao").val() == undefined || $("#sellouhao").val() == "") {
            alert('请选择楼号！');
        } else if ($("#selceng").val() == "请选择" || $("#selceng").val() == undefined || $("#selceng").val() == "") {
            alert('请选择层！');
        } else if ($("#selmen").val() == "请选择" || $("#selmen").val() == undefined || $("#selmen").val() == "") {
            alert('请选择门！');
        } else if ($("#iptmoney").val() == "") {
            alert('成交金额不能为空！');
        } else {
            $("#i_btn_queding").attr("disabled", "disabled");
            $.ajax({
                type: "POST",
                url: "../KeHu/Tianjiaxiaoshou",
                cache: false,  //禁用缓存
                data: { ChengJiaoJinE: $("#iptmoney").val(), Id: $("#IptId").val(), zhuangtaiya: $("#i_sle_ZhuangTai").val(), "LouHao": $("#sellouhao").val(), "XiaoQuId": $("#selxiaoqu").val(), "Ceng": $("#selceng").val(), "Men": $("#selmen").val() },  //传入组装的参数
                dataType: "text",
                success: function (result) {
                    $("#i_btn_queding").removeAttr("disabled", "disabled");
                    if (result == -1) {
                        $("#iptmoney").val("");
                        alert('成功！');
                        //window.location.href = 'ShuJuZhongXin';
                    } else if (result == -2) {
                        alert('客户失败！');
                    } else if (result == -3) {
                        alert('销售失败！');
                    } else if (result == -4) {
                        alert('销售详细失败！');
                    } else if (result == -5) {
                        alert('房源失败！');
                    } else if (result == -6) {
                        alert('客户房源失败！');
                    }
                }
            })
        }
    }

    //显示房源状态
    function zhuangtai2() {
        $.ajax({
            type: "POST",
            url: "../KeHu/fangyuanzhuangtai",
            cache: false,  //禁用缓存
            data: { "LouHao": $("#sellouhao").val(), "XiaoQuId": $("#selxiaoqu").val(), "Ceng": $("#selceng").val(), "Men": $("#selmen").val() },  //传入组装的参数
            dataType: "text",
            success: function (result) {
                $("#zhuangtai").text(result);
                if (result != "未出售") {
                    $("#i_btn_queding").attr("disabled", "disabled");
                } else {
                    $("#i_btn_queding").removeAttr("disabled", "disabled");
                }
            }
        })
    }

    //显示金额
    function xianshiJine(Id) {
        $("#Id").text(Id)
        $.ajax({
            type: "POST",
            url: "../KeHu/Xianshijine",
            cache: false,  //禁用缓存
            data: { "Id": "" + Id + "" },  //传入组装的参数
            dataType: "json",
            success: function (result) {
                console.log(result);
                $(result).each(function (key) {
                    $("#i_lbl_KeHuXingMing").text(result[key].t_KeHuBiao.KeHuXingMing);
                    if (result[key].ChengJiaoJinE != undefined) {
                        $("#i_lbl_ChengJiaoJinE").text(result[key].ChengJiaoJinE + "元");
                    } else {
                        $("#i_lbl_ChengJiaoJinE").text(0 + "元");
                    }
                })
            }
        })
        bang2(Id);
    }

    //判断状态修改
    function zhuangtai(Id, panduan, shoujihaoma) {
        $(".yong > .btn").attr("disabled", "disabled");
        $("#i_ipt_shoujihaoma").val(shoujihaoma);
        if (panduan == 1) {
            renchourengou(Id, "已认筹")
        }
        if (panduan == 2) {
            renchourengou(Id, "已认购")
        }
        if (panduan == 3) {
            renchourengou(Id, "已签约")
        }
        if (panduan == 4) {
            renchourengou(Id, "已退房")
        }
    };

    //认筹认购签约
    function renchourengou(Id, zhuangtai) {
        $.ajax({
            type: "POST",
            url: "../KeHu/Kehuxiugai",
            cache: false,  //禁用缓存
            data: { "id": "" + Id + "", "zhuangtai": "" + zhuangtai + "" },  //传入组装的参数
            dataType: "text",
            success: function (result) {
                if (result == -1) {
                    bang2($("#Id").text());
                    xianshiJine($("#Id").text());
                    //window.location.href = 'ShuJuZhongXin';
                } else if (result == -2) {
                    alert("客户失败");
                } else if (result == -3) {
                    alert("销售失败");
                } else if (result == -4) {
                    alert("销售详细失败");
                } else if (result == -5) {
                    alert("房源失败");
                } else if (result == -6) {
                    alert("客户房源失败");
                }
                $(".yong > .btn").removeAttr("disabled", "disabled");
            }
        })
    }

    //重置
    function chongzhi() {
        $("#ipt_kehumingcheng").val('');
        $("#ipt_shoujihao").val('');
        bang('不查');
    };

    //关闭清空
    function guanbiqingkong() {
        $("#i_lbl_KeHuXingMing").text("");
        $("#i_lbl_ChengJiaoJinE").text("");
    }

    //获取地址栏值
    function getQuery(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return decodeURI(r[2]); return null;
    }
</script>



@*//认筹认购签约
    function shifouyouzhi(Id, zhuangtai) {
        $.ajax({
            type: "POST",
            url: "../KeHu/Kehuxiaoqu",
            cache: false,  //禁用缓存
            data: { "kehuid": "" + Id + "" },  //传入组装的参数
            dataType: "text",
            success: function (result) {
                if (result.indexOf('成功') != -1) {
                    if (result.indexOf('0') == -1) {
                        $("#selxiaoqu").val(result.substring(result.indexOf('成功') + 2, result.length))
                        $("#selxiaoqu").attr("disabled", "disabled");
                        //下拉框刷新
                        $.ajax({
                            url: "../KeHu/BindSelLouHao",
                            type: "post",
                            data: { "XiaoQuId": $("#selxiaoqu").val() },
                            dataType: "json",
                            success: function (response) {
                                if ($("#selxiaoqu").val() != 0) {
                                    var ddl = $("#sellouhao");
                                    var opt0 = $("<option></option>").text("请选择").val(0);
                                    ddl.append(opt0);
                                }
                                $(response).each(function (key) {
                                    var opt = $("<option></option>").text(response[key].LouHao + "号楼").val(response[key].LouHao);
                                    ddl.append(opt);
                                })
                            }
                        });
                    } else {
                        $("#selxiaoqu").removeAttr("disabled", "disabled");
                    }
                    $("#IptId").val(Id);
                    $("#IptPanDuan").val(zhuangtai);
                    $(".tanceng").click();
                } else {
                    renchourengou(Id, zhuangtai)
                }
            }
        })
    }

    //选择房源修改
    function SubmitUpdate() {
        if ($("#selxiaoqu").val() == "请选择" || $("#selxiaoqu").val() == undefined || $("#selxiaoqu").val() == "") {
            alert('请选择小区！');
        } else if ($("#sellouhao").val() == "请选择" || $("#sellouhao").val() == undefined || $("#sellouhao").val() == "") {
            alert('请选择楼号！');
        } else if ($("#selceng").val() == "请选择" || $("#selceng").val() == undefined || $("#selceng").val() == "") {
            alert('请选择层！');
        } else if ($("#selmen").val() == "请选择" || $("#selmen").val() == undefined || $("#selmen").val() == "") {
            alert('请选择门！');
        } else {
            $("#nb").removeAttr("hidden");
            $("#bt_ChongZhiE").attr("disabled", "disabled");
            $.ajax({
                type: "POST",
                url: "../KeHu/UpdateKeHu4",
                cache: false,  //禁用缓存
                data: { ChengJiaoJinE: $("#iptmoney").val(), Id: $("#IptId").val(), zhuangtaiya: $("#IptPanDuan").val(), shoujihaoma: $("#IptPanDuan").val(), "LouHao": $("#sellouhao").val(), "XiaoQuId": $("#selxiaoqu").val(), "Ceng": $("#selceng").val(), "Men": $("#selmen").val() },  //传入组装的参数
                dataType: "text",
                success: function (result) {
                    $("#bt_ChongZhiE").removeAttr("disabled", "disabled");
                    if (result == -1) {
                        //alert('成功！');
                        //$("#guanbiaddkehu").click();
                        //BindSelXiaoQu()
                        window.location.href = 'ShuJuZhongXin';
                    } else if (result == -2) {
                        alert('客户失败！');
                    } else if (result == -3) {
                        alert('销售失败！');
                    } else if (result == -4) {
                        alert('销售详细失败！');
                    } else if (result == -5) {
                        alert('房源失败！');
                    } else if (result == -6) {
                        alert('客户房源失败！');
                    } else if (result == -7) {
                        alert('该房屋已出售或已审核！');
                    }
                    $(".yong > .btn").removeAttr("disabled", "disabled");
                    //else if (result == -8) {
                    //    alert('已存在同手机号码购买当前小区房子请完成后，重新添加客户！');
                    //}
                }
            })
        }
    }*@